<template>
  <a-spin :spinning="confirmLoading">
    <a-form-model ref="form" :model="models" :rules="validatorRules">
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="content" required label="总结报告相关内容">
        <a-textarea :rows="5" v-model="models.content" placeholder="填写与总结汇报相关的一些内容概要" />
      </a-form-model-item>
      <a-form-model-item
        :labelCol="labelCol"
        :wrapperCol="wrapperCol"
        prop="reportType"
        required
        label="总结报告的类型"
      >
        <j-dict-select-tag placeholder="总结报告的类型" dictCode="work_plan_reprt" v-model="models.reportType" />
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="wordNumber" required label="字数要求">
        <a-input-number v-model="models.wordNumber" placeholder="请输入字数(<=3000)" />
      </a-form-model-item>
    </a-form-model>
  </a-spin>
</template>

<script>
// import IndexChart from './IndexChart'
// import IndexTask from "./IndexTask"
// import IndexBdc from './IndexBdc'
import { mapGetters } from 'vuex'
import { sessionNoteList } from '@/api/api'
import { deleteAction } from '@/api/manage'
export default {
  name: 'WorkPlanReprt',
  components: {
    // IndexChart,
    // IndexTask,
    // IndexBdc
  },
  props: {
    model: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      models: this.model,
      confirmLoading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 },
      },
      validatorRules: {
        content: [{ required: true, message: '请输入总结报告相关内容' }],
        reportType: [{ required: true, message: '请选择总结报告类型' }],
        wordNumber: [{ required: true, message: '请输入字数' }],
      },
    }
  },
  created() {},
  computed: {
    models1() {
      return this.models
    },
  },
  watch: {
    models1: {
      handler(newVal, oldVal) {
        // console.log('newVal + oldVal',newVal, oldVal)
        // console.log('handler',newVal,  this.model)
        if (!newVal.wordNumber) {
          //只需判断一个即可
          this.$set(this.model, "wordNumber", "350");
          
        }
      },
      deep: true,
      immediate: true,
    },
  },
  mounted() {},
  methods: {
    generatedBtnProp() {
      let obj = {
        content: this.models.content,
        reportType: this.models.reportType,
        wordNumber: this.models.wordNumber,
      }
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$emit('appApiAsk', 1, obj)
        } else {
          this.$emit('appApiAsk', 2, obj)
        }
      })
    },
  },
}
</script>

<style lang="less">
</style>